package kitread.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class Downloader {

	public static String downloadPage(URL url) {
		StringBuffer sb = new StringBuffer();
		try {
			URLConnection conn = url.openConnection();
			BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
			String inputLine;
			while ((inputLine = br.readLine()) != null) {
				sb.append(inputLine);
			}
			br.close();
		} catch(IOException e) {
			e.printStackTrace();
		}
		return sb.toString();
	}
}
